package service.impl;

import java.util.ArrayList;
import java.util.List;

import org.apache.log4j.Logger;

import dto.MItem;
import service.MListManager;
import util.JacksonUtil;
import util.NetworkConfig;
import util.UrlConnectionUtil;

public class MListManagerImpl implements MListManager{

	@Override
	public List<MItem> getMList() {
		List<MItem> list = new ArrayList<MItem>();
		try{
			List<MItem> tempList = JacksonUtil.fromJsonToArray(UrlConnectionUtil.get(NetworkConfig.URL_ADMIN_GET_ALL_MUSER, null), MItem.class);
			if(tempList!=null){
				list.addAll(tempList);
			}
		}catch(Exception e){
			Logger.getLogger(MListManagerImpl.class).error("请求A端获取店铺列表异常！");
			return null;
		}
		return list;
	}
}
